import * as THREE from 'three';
import renderer from '@/config/render'
import camera from '@/config/camera'
import control from '@/controls/testControl'
import scenes from "@/scenes/testScene";
import GlobalGroup from '@/utils/GlobalGroup';
import GUI from '@/GUI/ui'

//全局环境光
const lightAll = new THREE.AmbientLight( 0x606060 ); // soft white light



// 场景处理
scenes.scene.background = new THREE.Color( 0xbfd1e5 );


//向场景中添加对象
scenes.scene.add( GlobalGroup )// 引入全局3D元素
scenes.scene.add( lightAll )

function animate() {
    control.trigger(scenes.scene)
	renderer.render( scenes.scene, camera );
    requestAnimationFrame(animate)
}

export default {
    renders(){
        animate();
        GUI.renderControlBody()
    }
}
